<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <th:block th:replace="headfoot/head::head_ztree"></th:block>
</head>

<body>
<div class="container-fluid kj-form-container">
    <form
            id="form" class="form-horizontal validate kj-form-container-content" role="form"
            method="post" action="/personal/save"
    >
        <input type="hidden" id="id" name="id" th:value="${entity?.id}"/>

        <div class="from-group row has-feedback kj-form-title-button-bar">
            <div class="col-md-7">
                <button type="button" class="btn btn-info btn-sm  kj-btn-save personal-save">
                    <i class="iconfont icon-baocun"></i>&ensp;确认修改
                </button>
                <button type="button" class="btn btn-default btn-sm action-ajax-form hidden real-personal-save"
                        data-after="afterPersonalSave">
                    <i class="iconfont icon-baocun"></i>&ensp;确认修改
                </button>
            </div>

        </div>

        <div class="card kj-form-container-card">
            <div class="card-header kj-form-container-card-header">
                <h4>
                    <strong>学生基本信息</strong>
                </h4>
            </div>
            <div class="card-body kj-form-container-card-body">

                <div class="form-group">
                    <label class="col-md-2 control-label kj-form-container-content-label">姓名</label>
                    <div class="col-md-3 validateDiv">
                        <input class="form-control input-sm kj-form-container-content-input"
                               name="name"
                               type="text"
                               data-rule-required="true" data-rule-maxlength="20"
                               autocomplete="off"
                               placeholder="姓名"
                               th:value="${entity?.name}"/>
                    </div>

                    <label class="col-md-2 control-label kj-form-container-content-label">学号</label>
                    <div class="col-md-3 validateDiv">
                        <input class="form-control input-sm kj-form-container-content-input"
                               disabled="disabled"
                               th:value="${entity?.number}"/>
                    </div>
                </div>


                <div class="form-group">
                    <label class="col-md-2 control-label kj-form-container-content-label">入学年份</label>
                    <div class="col-md-3 validateDiv">
                        <input class="form-control input-sm kj-form-container-content-input"
                               name="year"
                               type="text"
                               disabled="disabled"
                               data-rule-required="true"
                               data-rule-digits="true"
                               data-rule-maxlength="4"
                               data-rule-minlength="4"
                               autocomplete="off"
                               placeholder="入学年份"
                               th:value="${entity?.year}"/>
                    </div>

                    <label class="col-md-2 control-label kj-form-container-content-label">班级</label>
                    <div class="col-md-3 validateDiv">
                        <select id="classesId" class="form-control input-sm kj-form-container-content-select "
                                name="classesId"
                                th:data-value="${entity?.classesId}"
                                disabled="disabled"
                                data-rule-required="true">
                            <option value="">--请选择--</option>
                            <option th:each="cls:${classes}" th:value="${cls.code}">[[${cls.text}]]</option>

                        </select>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-md-2 control-label kj-form-container-content-label">院系</label>
                    <div class="col-md-3 validateDiv">
                        <select id="faculty" class="form-control input-sm kj-form-container-content-select "
                                vic:dict="faculty"
                                data-option="--请选择--"
                                data-linkage="true"
                                data-linkage-url="/system/dict/byParentValue?parentTypeCode=major"
                                data-linkage-target="#major"
                                disabled="disabled"
                                th:data-value="${entity?.faculty}">

                        </select>
                    </div>

                    <label class="col-md-2 control-label kj-form-container-content-label">专业</label>
                    <div class="col-md-3 validateDiv">
                        <select id="major" class="form-control input-sm kj-form-container-content-select "
                                name="major"
                                disabled="disabled"
                                th:data-value="${entity?.major}"
                                data-rule-required="true">
                            <option value="">--请选择--</option>

                        </select>
                    </div>
                </div>

                <div class="form-group">

                    <label class="col-md-2 control-label kj-form-container-content-label">状态</label>
                    <div class="col-md-3 validateDiv">
                        <select id="enabled"
                                class="form-control input-sm kj-form-container-content-select"
                                name="status"
                                disabled="disabled"
                                th:data-value="${entity?.status}">
                            <option value="">--请选择--</option>
                            <option value="0">未入学</option>
                            <option value="1">就读中</option>
                            <option value="2">已毕业</option>

                        </select>
                    </div>
                </div>
            </div>
        </div>

        <div class="card kj-form-container-card">
            <div class="card-header kj-form-container-card-header">
                <h4>
                    <strong>详细信息</strong>
                </h4>
            </div>
            <div class="card-body kj-form-container-card-body">
                <input type="hidden" id="info-id" name="info.id" th:value="${entity?.info?.id}"/>
                <div class="form-group">
                    <label class="col-md-2 control-label kj-form-container-content-label">身份证</label>
                    <div class="col-md-3 validateDiv">
                        <input class="form-control input-sm kj-form-container-content-input"
                               name="info.cardId"
                               type="text"
                               data-rule-maxlength="18"
                               data-rule-minlength="18"
                               autocomplete="off"
                               placeholder="身份证号码"
                               th:value="${entity?.info?.cardId}"/>
                    </div>

                    <label class="col-md-2 control-label kj-form-container-content-label">地址</label>
                    <div class="col-md-3 validateDiv">
                        <input class="form-control input-sm kj-form-container-content-input"
                               name="info.address"
                               type="text"
                               data-rule-maxlength="18"
                               autocomplete="off"
                               placeholder="地址"
                               th:value="${entity?.info?.address}"/>
                    </div>
                </div>


                <div class="form-group">
                    <label class="col-md-2 control-label kj-form-container-content-label">电话</label>
                    <div class="col-md-3 validateDiv">
                        <input class="form-control input-sm kj-form-container-content-input"
                               name="info.phone"
                               type="text"
                               data-rule-maxlength="11"
                               data-rule-minlength="11"
                               autocomplete="off"
                               placeholder="手机号"
                               th:value="${entity?.info?.phone}"/>
                    </div>

                    <label class="col-md-2 control-label kj-form-container-content-label">生日</label>
                    <div class="col-md-3 validateDiv">
                        <input class="form-control input-sm kj-form-container-content-input datetime"
                               name="info.birthday"
                               type="text"
                               data-format="yyyy-mm-dd"
                               data-min-view="year"
                               th:value="${#calendars.format(entity?.info?.birthday,'yyyy-MM-dd')}"
                        />

                        </select>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-md-2 control-label kj-form-container-content-label">其他信息</label>
                    <div class="col-md-8 validateDiv">
                        <textarea class="form-control input-sm novalidate kj-form-container-content-textarea"
                                  name="info.remark" rows="6" placeholder="其他信息"
                                  th:text="${entity?.info?.remark}"></textarea>

                        </select>
                    </div>

                </div>
            </div>
        </div>
    </form>
</div>

<th:block th:replace="headfoot/foot::form_ztree_foot"></th:block>
<script>


    function afterPersonalSave(result) {
        location.reload();
    }

    $(function () {
        $(".personal-save").on("click", function () {
            $.confirm({
                title: "保存",
                content: "确认修改吗？",
                buttons: {
                    "确认": function () {
                        $(".real-personal-save").trigger("click");
                    },
                    "取消": function () {
                        location.reload();
                    }
                }

            });
        });
    });

</script>


</body>
</html>